home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source2.lha / source / amiga / Trackdisk.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  8.3 KB  |  272 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: Trackdisk.mod $
  4.   Description: trackdisk device structure and value definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   $VER: trackdisk.h 33.13 (28.11.90)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  24. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  25. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  26.  
  27. MODULE [2] Trackdisk;
  28.  
  29. IMPORT e := Exec, s := Sets;
  30.  
  31.  
  32. (*
  33.  *--------------------------------------------------------------------
  34.  *
  35.  * Physical drive constants
  36.  *
  37.  *--------------------------------------------------------------------
  38.  *)
  39.  
  40. CONST
  41.  
  42.   numSecs * = 11;
  43.   numUnits * = 4;
  44.  
  45. (*
  46.  *--------------------------------------------------------------------
  47.  *
  48.  * Useful constants
  49.  *
  50.  *--------------------------------------------------------------------
  51.  *)
  52.  
  53. CONST
  54.  
  55. (* -- sizes before mfm encoding *)
  56.   sector * = 512;
  57.   secShift * = 9;           (* log tdSECTOR *)
  58.  
  59. (*
  60.  *--------------------------------------------------------------------
  61.  *
  62.  * Driver Specific Commands
  63.  *
  64.  *--------------------------------------------------------------------
  65.  *)
  66.  
  67.  
  68. CONST
  69.  
  70.   name * = "trackdisk.device";
  71.  
  72.   extCom * = -10000H;              (* for internal use only! *)
  73.  
  74.  
  75.   motor *        = e.nonstd+0;  (* control the disk's motor *)
  76.   seek *         = e.nonstd+1;  (* explicit seek (for testing) *)
  77.   format *       = e.nonstd+2;  (* format disk *)
  78.   remove *       = e.nonstd+3;  (* notify when disk changes *)
  79.   changeNum *    = e.nonstd+4;  (* number of disk changes *)
  80.   changeState *  = e.nonstd+5;  (* is there a disk in the drive? *)
  81.   protStatus *   = e.nonstd+6;  (* is the disk write protected? *)
  82.   rawRead *      = e.nonstd+7;  (* read raw bits from the disk *)
  83.   rawWrite *     = e.nonstd+8;  (* write raw bits to the disk *)
  84.   getDriveType * = e.nonstd+9;  (* get the type of the disk drive *)
  85.   getNumTracks * = e.nonstd+10; (* # of tracks for this type drive *)
  86.   addChangeInt * = e.nonstd+11; (* tdREMOVE done right *)
  87.   remChangeInt * = e.nonstd+12; (* remove softint set by ADDCHANGEINT *)
  88.   getGeometry *  = e.nonstd+13; (* gets the disk geometry table *)
  89.   eject *        = e.nonstd+14; (* for those drives that support it *)
  90.   lastComm *     = e.nonstd+15;
  91.  
  92. (*
  93.  *
  94.  * The disk driver has an "extended command" facility.  These commands
  95.  * take a superset of the normal IO Request block.
  96.  *
  97.  *)
  98.  
  99. CONST
  100.  
  101.   extWrite *       = e.write  + extCom;
  102.   extRead *        = e.read   + extCom;
  103.   extMotor *       = motor    + extCom;
  104.   extSeek *        = seek     + extCom;
  105.   extFormat *      = format   + extCom;
  106.   extUpdate *      = e.update + extCom;
  107.   extClear *       = e.clear  + extCom;
  108.   extRawRead *     = rawRead  + extCom;
  109.   extRawWrite *    = rawWrite + extCom;
  110.  
  111. (*
  112.  *
  113.  * extended IO has a larger than normal io request block.
  114.  *
  115.  *)
  116.  
  117. TYPE
  118.  
  119.   IOExtTDPtr * = POINTER TO IOExtTD;
  120.   IOExtTD * = RECORD (e.IORequestBase)
  121.     req *      : e.IOStdReq;
  122.     count *    : e.ULONG;
  123.     secLabel * : e.ULONG;
  124.   END; (* IOExtTD *)
  125.  
  126. (*
  127.  *  This is the structure returned by tdDRIVEGEOMETRY
  128.  *  Note that the layout can be defined three ways:
  129.  *
  130.  *  1. TotalSectors
  131.  *  2. Cylinders and CylSectors
  132.  *  3. Cylinders, Heads, and TrackSectors.
  133.  *
  134.  *  #1 is most accurate, #2 is less so, and #3 is least accurate.  All
  135.  *  are usable, though #2 and #3 may waste some portion of the available
  136.  *  space on some drives.
  137.  *)
  138.  
  139. TYPE
  140.  
  141.   DriveGeometryPtr * = POINTER TO DriveGeometry;
  142.   DriveGeometry * = RECORD
  143.     sectorSize *   : e.ULONG;  (* in bytes *)
  144.     totalSectors * : e.ULONG;  (* total # of sectors on drive *)
  145.     cylinders *    : e.ULONG;  (* number of cylinders *)
  146.     cylSectors *   : e.ULONG;  (* number of sectors/cylinder *)
  147.     heads *        : e.ULONG;  (* number of surfaces *)
  148.     trackSectors * : e.ULONG;  (* number of sectors/track *)
  149.     bufMemType *   : e.ULONG;  (* preferred buffer memory type *)
  150.                                (* (usually memfPUBLIC) *)
  151.     deviceType *   : SHORTINT; (* codes as defined in the SCSI-2 spec *)
  152.     flags *        : s.SET8;   (* flags, including removable *)
  153.     reserved *     : e.UWORD;
  154.   END; (* DriveGeometry *)
  155.  
  156. CONST
  157.  
  158. (* device types *)
  159.   directAccess *         = 0;
  160.   sequentialAccess *     = 1;
  161.   printer *              = 2;
  162.   processor *            = 3;
  163.   worm *                 = 4;
  164.   cdRom *                = 5;
  165.   scanner *              = 6;
  166.   opticalDisk *          = 7;
  167.   mediumChanger *        = 8;
  168.   communication *        = 9;
  169.   unknown *              = 31;
  170.  
  171. (* flags *)
  172.   removable *           = 0;
  173.  
  174. (*
  175. ** raw read and write can be synced with the index pulse.  This flag
  176. ** in io request's ioFLAGS field tells the driver that you want this.
  177. *)
  178.  
  179.   indexSync * = 4;
  180. (*
  181. ** raw read and write can be synced with a $4489 sync pattern.  This flag
  182. ** in io request's ioFLAGS field tells the driver that you want this.
  183. *)
  184.   wordSync *  = 5;
  185.  
  186.  
  187. (* labels are tdLabelSize bytes per sector *)
  188.  
  189.   labelSize * = 16;
  190.  
  191. (*
  192. ** This is a bit in the FLAGS field of OpenDevice.  If it is set, then
  193. ** the driver will allow you to open all the disks that the trackdisk
  194. ** driver understands.  Otherwise only 3.5" disks will succeed.
  195. *)
  196.  
  197.   allowNon35 *       = 0;
  198.  
  199. (*
  200. **  If you set the tdbAllowNon35 bit in OpenDevice, then you don't
  201. **  know what type of disk you really got.  These defines are for the
  202. **  tdGETDRIVETYPE command.  In addition, you can find out how many
  203. **  tracks are supported via the tdGETNUMTRACKS command.
  204. *)
  205.  
  206.   drive35 *        = 1;
  207.   drive525 *       = 2;
  208.   drive35150rpm *  = 3;
  209.  
  210. (*
  211.  *--------------------------------------------------------------------
  212.  *
  213.  * Driver error defines
  214.  *
  215.  *--------------------------------------------------------------------
  216.  *)
  217.  
  218. CONST
  219.  
  220.   notSpecified *      = 20;      (* general catchall *)
  221.   noSecHdr *          = 21;      (* couldn't even find a sector *)
  222.   badSecPreamble *    = 22;      (* sector looked wrong *)
  223.   badSecID *          = 23;      (* ditto *)
  224.   badHdrSum *         = 24;      (* header had incorrect checksum *)
  225.   badSecSum *         = 25;      (* data had incorrect checksum *)
  226.   tooFewSecs *        = 26;      (* couldn't find enough sectors *)
  227.   badSecHdr *         = 27;      (* another "sector looked wrong" *)
  228.   writeProt *         = 28;      (* can't write to a protected disk *)
  229.   diskChanged *       = 29;      (* no disk in the drive *)
  230.   seekError *         = 30;      (* couldn't find track 0 *)
  231.   noMem *             = 31;      (* ran out of memory *)
  232.   badUnitNum *        = 32;      (* asked for a unit > NUMUNITS *)
  233.   badDriveType *      = 33;      (* not a drive that trackdisk groks *)
  234.   driveInUse *        = 34;      (* someone else allocated the drive *)
  235.   postReset *         = 35;      (* user hit reset; awaiting doom *)
  236.  
  237. (*
  238.  *--------------------------------------------------------------------
  239.  *
  240.  * public portion of the unit structure
  241.  *
  242.  *--------------------------------------------------------------------
  243.  *)
  244.  
  245. TYPE
  246.  
  247.   PublicUnitPtr * = POINTER TO PublicUnit;
  248.   PublicUnit * = RECORD (e.UnitBase)
  249.     unit *           : e.Unit;   (* base message port *)
  250.     comp01Track *    : e.UWORD;  (* track for first precomp *)
  251.     comp10Track *    : e.UWORD;  (* track for second precomp *)
  252.     comp11Track *    : e.UWORD;  (* track for third precomp *)
  253.     stepDelay *      : e.ULONG;  (* time to wait after stepping *)
  254.     settleDelay *    : e.ULONG;  (* time to wait after seeking *)
  255.     retryCnt *       : SHORTINT; (* # of times to retry *)
  256.     pubFlags *       : s.SET8;   (* public flags, see below *)
  257.     currTrk *        : e.UWORD;  (* track the heads are over... *)
  258.                                  (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  259.     calibrateDelay * : e.ULONG;  (* time to wait after stepping *)
  260.                                  (* during a recalibrate *)
  261.     counter *        : e.ULONG;  (* counter for disk changes... *)
  262.                                  (* ONLY ACCESS WHILE UNIT IS STOPPED! *)
  263.   END; (* PublicUnit *)
  264.  
  265. CONST
  266.  
  267. (* flags for tduPubFlags *)
  268.   noClick *    = 0;
  269.  
  270.  
  271. END Trackdisk.
  272.